package com.wangshuo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wangshuo.domain.SysUser;
import com.wangshuo.model.vo.RouterVo;
import com.wangshuo.model.vo.SysUserQueryVo;
import com.wangshuo.service.SysMenuService;
import com.wangshuo.service.SysUserService;
import com.wangshuo.mapper.SysUserMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
* @author 13326
* @description 针对表【sys_user(用户表)】的数据库操作Service实现
* @createDate 2025-02-06 17:45:32
*/
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
    implements SysUserService{
   @Resource
   private SysUserMapper sysUserMapper;
   @Resource
   private SysMenuService service;
    @Override
    public IPage<SysUser> getlist(IPage<SysUser> page, SysUserQueryVo sysUserQueryVo){
        return sysUserMapper.getlist(page,sysUserQueryVo);
    }
    @Override
    public HashMap<String, Object> getUserInfo(Long uid){
        HashMap<String,Object> res=new HashMap<>();
        LambdaQueryWrapper<SysUser> lambdaQueryWrapper=new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(SysUser::getId,uid);
        SysUser sysUser=sysUserMapper.selectOne(lambdaQueryWrapper);
        res.put("userinfo",sysUser);
        List<RouterVo> list=service.findUserMenuList(sysUser.getId());
res.put("routers",list);
return res;
    }

}




